package com.xzc.jdk.io.Input;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class InputStreamTest {
    @Test
    public void test() throws Exception {
        long bt = System.nanoTime();
        InputStream is = new FileInputStream("d:/satis_ftp.rar");
        try {
            long size = 0;
            byte[] buf = new byte[4096];
            int read;
            while ((read = is.read(buf)) != -1) {
                size += read;
            }
            System.out.println(size);
            System.out.println(System.nanoTime() - bt);
        } finally {
            try {
                is.close();
            } catch (IOException ex) {
            }
        }
    }
}
